
import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class VendingMachineItemTest {

	//Test Fixture object declared. 
	VendingMachineItem itema;
	VendingMachineItem itemb;
	
	@Before
	public void setUp() throws Exception {
		itema = new VendingMachineItem("itema", 1.0);
	}

	@After
	public void tearDown() throws Exception 
	{
	}
	
	@Test(expected=VendingMachineException.class)
	public void testNegativeMoneyException()
	{
		VendingMachineItem itemb = new VendingMachineItem("Invalid price", -5.0);
	}

	@Test
	public void testGetName() 
	{
		//Testing for the validity of item name.
		assertEquals("itema", itema.getName());
	}

	@Test
	public void testGetPrice() 
	{
		//Testing for the validity of the price.
		assertTrue(1.0 - itema.getPrice() == 0);
	}

}
